/**
 * Created by 枫 on 2014/8/15.
 */

var jeasyui = (function () {
    var je = function (d) {
        if (typeof(d) == 'object') {
            return je.fn.init(d);
        } else if ((typeof d == 'string') && d.constructor == String) {
            return je.fn.get(d);
        }else {
            return je.fn;
        }
    };
    je.fn = je.prototype = {
        init: function (d) {
            this.tags = d;
            return this;
        },
        get: function (id) {
            var tagName = this.tags[id];
            this.tagName = tagName;
           // this.tag = $('#'+id)[tagName]();
            this.id = id;
            return this;
        },
        val: function () {
            return $('#'+this.id)[this.tagName];
        },
        getSelectedIndex:function(){
            var select = $('#'+this.id)[this.tagName]('getSelected');
            if(this.tagName == 'tabs'){
                return $('#'+this.id)[this.tagName]('getTabIndex',$(select));
            }else if(this.tagName == 'accordion'){
                return $('#'+this.id)[this.tagName]('getPanelIndex',$(select).panel());
            }
        }
    };
    je.prototype = je.fn;

    return je;
})();
